package com.yaorange.service.impl;

import com.yaorange.dao.NoticeMapper;
import com.yaorange.entity.Notice;
import com.yaorange.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class NoticeServiceImpl implements NoticeService {
    @Autowired
    private NoticeMapper noticeMapper;

    @Override
    public List<Notice> getList() {
        return noticeMapper.selectAll();
    }

    @Override
    public int add(Notice notice) {
        return noticeMapper.insertSelective(notice);
    }

    @Override
    public int delete(Integer noticeId) {
        return noticeMapper.deleteByPrimaryKey(noticeId);
    }

    @Override
    public Notice findNotice(Integer noticeId) {
        return noticeMapper.selectByPrimaryKey(noticeId);
    }

    @Override
    public int updateNotice(Notice notice) {
        return noticeMapper.updateByPrimaryKeySelective(notice);
    }
}
